/* webview/css/components.css */

/* === 错误通知样式 === */
.error-notification {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    min-width: 300px;
    max-width: 500px;
    background: var(--vscode-inputValidation-errorBackground);
    border: 1px solid var(--vscode-inputValidation-errorBorder);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.error-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--vscode-inputValidation-errorForeground);
}

.error-content .codicon-error {
    font-size: 16px;
    flex-shrink: 0;
}

.error-message {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
}

.error-close-btn {
    background: transparent;
    border: none;
    color: var(--vscode-inputValidation-errorForeground);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.error-close-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

/* === 按钮通用样式 === */
vscode-button {
    font-family: var(--vscode-font-family);
}

/* 命令栏图标按钮统一尺寸 */
#command-bar vscode-button::part(control) {
    --_btn-size: 28px;
    min-width: var(--_btn-size);
    width: var(--_btn-size);
    height: var(--_btn-size);
    padding: 0;
    background-color: transparent;
    border: none;
    border-radius: 6px;
}
#command-bar vscode-button::part(control):hover {
    background-color: var(--vscode-toolbar-hoverBackground, var(--vscode-list-hoverBackground));
}

/* 发送按钮 (圆形) */
#send-button::part(control) {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 999px;
    background: transparent;
    border: none;
}
#send-button::part(control):hover {
    background: var(--vscode-toolbar-hoverBackground, var(--vscode-button-secondaryHoverBackground));
}

/* === 通用徽章 (Badge) === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.85em;
    line-height: 1.2;
}

.badge-category {
    background-color: var(--vscode-badge-background);
    color: var(--vscode-badge-foreground);
}

.badge-confirm {
    background-color: var(--vscode-inputValidation-warningBackground);
    color: var(--vscode-inputValidation-warningForeground);
}

/* === 加载动画 === */
.codicon-loading {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* === 对话框组件 === */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.dialog-overlay.show {
    opacity: 1;
}

.dialog-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--vscode-editor-background);
    border: 1px solid var(--vscode-panel-border);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    min-width: 500px;
    max-width: 90vw;
    min-height: 300px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: all 0.2s ease;
    resize: both;
    overflow: hidden;
}

.dialog-container.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--vscode-panel-border);
    background: var(--vscode-editorGroupHeader-tabsBackground);
    border-radius: 8px 8px 0 0;
}

.dialog-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--vscode-foreground);
}

.dialog-close-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--vscode-foreground);
    opacity: 0.7;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.dialog-close-btn:hover {
    opacity: 1;
    background: var(--vscode-toolbar-hoverBackground);
}

.dialog-close-btn .codicon {
    font-size: 16px;
}

.dialog-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
    max-height: calc(85vh - 160px);
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--vscode-panel-border);
    background: var(--vscode-editorGroupHeader-tabsBackground);
    border-radius: 0 0 8px 8px;
}

.dialog-btn {
    min-width: 80px;
}

/* 对话框内的表单字段 */
.dialog-form-field {
    margin-bottom: 16px;
}

.dialog-form-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--vscode-foreground);
}

.dialog-form-field .field-description {
    font-size: 12px;
    color: var(--vscode-descriptionForeground);
    margin-top: 4px;
}

.dialog-form-field .field-required {
    color: var(--vscode-errorForeground);
    margin-left: 2px;
}

.dialog-form-field vscode-text-field,
.dialog-form-field vscode-text-area,
.dialog-form-field select {
    width: 100%;
}

/* 🟢 自定义下拉框样式 */
.dialog-form-field select.vscode-select {
    background: var(--vscode-input-background);
    color: var(--vscode-input-foreground);
    border: 1px solid var(--vscode-input-border, transparent);
    border-radius: 2px;
    padding: 6px 8px;
    font-family: var(--vscode-font-family);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

.dialog-form-field select.vscode-select:focus {
    border-color: var(--vscode-focusBorder);
    outline: 1px solid var(--vscode-focusBorder);
    outline-offset: -1px;
}

.dialog-form-field select.vscode-select:hover {
    background: var(--vscode-input-background);
}

.dialog-form-field vscode-checkbox {
    margin-top: 4px;
}

/* 对话框内的代码块 */
.dialog-code-block {
    background: var(--vscode-textCodeBlock-background);
    border: 1px solid var(--vscode-panel-border);
    border-radius: 4px;
    padding: 16px;
    font-family: var(--vscode-editor-font-family), 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre; /* 🟢 保持原始格式 */
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}
